﻿using System;
using System.Windows.Forms;
using Server.Network;

namespace Server.Manager
{
    class Loop
    {
         #region Singleton

        // private constructor
        private Loop() { }

        // singleton accessor
        static Loop instance;
        public static Loop Instance
        {
            get
            {
                if (instance == null)
                    instance = new Loop();
                return instance;
            }
        }

        #endregion

        #region Fields

        public bool isServerRunning;

        #endregion

        public void ServerLoop(object sender, EventArgs e)
        {
            while (isServerRunning)
            {
                NetworkManager.Instance.ReceivedData();
                Application.DoEvents();
            }
        }
    }
}
